//
//  CATransaction.swift
//  Documentation
//
//  Created by Toj on 8/9/23.
//

@available(iOS 2.0, *)
/**
 * 事务
 */
open class CATransaction : NSObject {

    // 开启事务
    open class func begin()

    // 提交事务
    open class func commit()

    /// 未知, 未用过
    open class func flush()

    /// 锁, 未用过
    open class func lock()
    open class func unlock()

    /// (读取/ 设置) 事务执行时间
    open class func animationDuration() -> CFTimeInterval
    open class func setAnimationDuration(_ dur: CFTimeInterval)

    open class func animationTimingFunction() -> CAMediaTimingFunction?

    open class func setAnimationTimingFunction(_ function: CAMediaTimingFunction?)
    
    /// (读取/ 设置) 图层行为是否禁用, 关闭动画
    open class func disableActions() -> Bool
    open class func setDisableActions(_ flag: Bool)

    /// 事务执行完回调
    open class func completionBlock() -> (() -> Void)?
    /// 设置: 事务执行完回调
    open class func setCompletionBlock(_ block: (() -> Void)?)

    /// (读取/ 设置)属性值
    open class func value(forKey key: String) -> Any?
    open class func setValue(_ anObject: Any?, forKey key: String)
}


/** 属性值 */
@available(iOS 2.0, *)
public let kCATransactionAnimationDuration: String

@available(iOS 2.0, *)
public let kCATransactionDisableActions: String

@available(iOS 3.0, *)
public let kCATransactionAnimationTimingFunction: String

@available(iOS 4.0, *)
public let kCATransactionCompletionBlock: String
